<template>
  <div id="youngcadresedit">
    <div v-show="pageLoading">数据加载中...</div>
    <el-switch v-show="!pageLoading" v-if="!Formal && !inRoles('ROLE_other')"
      v-model="showlog"
      active-text="原始申报数据"
      inactive-text="审核修改数据">
    </el-switch>
    <div v-if="showlog" style="padding-top:10px;">
        <table cellspacing="0" cellpadding="0" class="mytable">
          <tr>
            <th>单位名称</th>
            <td colspan="8">
              <template  v-if="inRoles('ROLE_other')">{{unitname}}</template>
              <template  v-else>{{id2name(original.ssdw,dwoptions)}}</template>
            </td>
          </tr>
          <tr>
            <th>姓名</th>
            <td style="width:220px">
              <template>{{original.xm}}</template>
            </td>
            <th>身份证号</th>
            <td style="width:230px">
              <template>{{original.sfzh}}</template>
            </td>
            <th>性别</th>
            <td style="width:230px">
              <template>{{original.xbText}}</template>
            </td>
            <th>出生年月</th>
            <td style="width:230px">
              <template>{{formatDate(original.csrq)}}</template>
            </td>
            <td style="width:240px" rowspan="4" align="center">
              <img v-if='original.tx' :src="this.$http.defaults.baseURL+$http.defaults.youngAPI+'api/gen/file/download?id='+parseInt(original.tx)" width="120" height="150">
              <div v-else class="youngnopic"></div>
            </td>
          </tr>
          <tr>
            <th>民族</th>
            <td>
              <template>{{original.mzText}}</template>
            </td>
            <th>政治面貌</th>
            <td>
              <template>{{original.zzmmText}}</template>
            </td>
            <th>参加工作时间</th>
            <td>
              <template>{{formatDate(original.cjgzsj)}}</template>
            </td>
            <th>专业技术职务</th>
            <td>
              <template>{{original.zyjszw}}</template>
            </td>
          </tr>
          <tr>
            <th>职务</th>
            <td>
              <template>{{original.zw}}</template>
            </td>
            <th>任现职务时间</th>
            <td>
              <template>{{formatDate(original.rxzwsj)}}</template>
            </td>
            <th rowspan="2" style="vertical-align: top;">任相当层次职务职级时间</th>
            <td colspan="3" rowspan="2">
              <template>{{formatDate(original.rxdcczwzjsj)}}</template>
            </td>
          </tr>
          <tr>
            <th>职级</th>
            <td>
              <template>{{original.zj}}</template>
            </td>
            <th>任现职级时间</th>
            <td>
              <template>{{formatDate(original.rxzjsj)}}</template>
            </td>
          </tr>
          <tr>
            <th>近三年考核情况</th>
            <td colspan="8">
              <div v-html="original.jsnkhqk.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>教育背景</th>
            <td colspan="8">
              <div v-html="original.jybj.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>工作简历</th>
            <td colspan="8">
              <div v-html="original.gzjl.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>分管或从事工作</th>
            <td colspan="8">
              <div v-html="original.fghcsgz.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>政治素质及政治表现</th>
            <td colspan="8">
              <div v-html="original.zzszjzzbx.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>能力特点、工作实绩和主要事例</th>
            <td colspan="8">
              <div v-html="original.nltd.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>主要不足</th>
            <td colspan="8">
              <div v-html="original.zybz.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>“四必”及巡视、信访、审计等情况</th>
            <td colspan="8">
              <div v-html="original.sbjxsxfsjdqk.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>本人面谈情况</th>
            <td colspan="8">
              <div v-html="original.brmtqk.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>培养方向和培养措施</th>
            <td colspan="8">
              <div v-html="original.pyfxhpycs.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>备注</th>
            <td colspan="8">
              <div v-html="original.bz.replace(/\n/g,'<br>')"></div>
            </td>
          </tr>
          <tr>
            <th>附件</th>
            <td colspan="8">
              <div>
                <div v-for="(item,index) in original.files" :key="index">
                  <el-link
                    :href="$http.defaults.baseURL+$http.defaults.youngAPI+'api/gen/file/download?id='+item.id"
                    icon="el-icon-paperclip"
                  >{{ item.name }}</el-link>
                </div>
              </div>
            </td>
          </tr>
        </table>
        <div style="margin:0 10px">
          <el-button @click.native="backToList">返回</el-button>
        </div>
    </div>
    <div v-else>
      <el-form :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" v-show="!pageLoading" :rules="editFormRules">
        <table cellspacing="0" cellpadding="0" class="mytable">
          <tr>
            <th>单位名称</th>
            <td colspan="8">
              <template v-if="!showDept||readOnly">{{id2name(editForm.ssdw,dwoptions)}}</template>
              <el-form-item prop="ssdw" v-else>
                <el-select  v-model="editForm.ssdw" filterable placeholder="请选择" style="width:600px">
                  <el-option
                    v-for="item in dwoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th>姓名</th>
            <td style="width:220px">
              <template v-if="readOnly">{{editForm.xm}}</template>
              <el-form-item prop="xm" v-else>
                <el-autocomplete style="width:160px" v-model="editForm.xm" :fetch-suggestions="searchPerson" placeholder="请输入姓名" :trigger-on-focus="false" @select="handleSelect">
                  <template slot-scope="{ item }">
                    {{ item.value }}：{{ item.data.a0192A }}({{ item.data.a0184 }})
                  </template>
                </el-autocomplete>
              </el-form-item>
            </td>
            <th>身份证号</th>
            <td style="width:230px">
              <template v-if="readOnly">{{editForm.sfzh}}</template>
              <el-form-item prop="sfzh" v-else>
                <el-input v-model="editForm.sfzh" style="width:190px"></el-input>
              </el-form-item>
            </td>
            <th>性别</th>
            <td style="width:230px">
              <template v-if="readOnly">{{id2name(editForm.xb,xboptions)}}</template>
              <el-form-item prop="xb" v-else>
                <el-select v-model="editForm.xb" placeholder="请选择" style="width:200px">
                  <el-option
                    v-for="item in xboptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
            <th>出生年月</th>
            <td style="width:230px">
              <template v-if="readOnly">{{formatDate(editForm.csrq)}}</template>
              <el-form-item prop="csrq" v-else>
                <el-input v-model="editForm.csrq" style="width:170px" placeholder="如20201001或202010"></el-input>
                <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                  <el-button type="text" icon="el-icon-info" />
                </el-tooltip>
              </el-form-item>
            </td>
            <td style="width:240px" rowspan="4" align="center">
              <template v-if="readOnly">
                <img v-if='imageUrl' :src="this.$http.defaults.baseURL+$http.defaults.youngAPI+'api/gen/file/download?id='+parseInt(imageUrl)" width="120" height="150">
                <div v-else class="youngnopic"></div>
              </template>
              <el-upload
                v-else
                class="avatar-uploader"
                :action="this.$http.defaults.baseURL+this.$http.defaults.youngAPI +'api/gen/file/upload/'"
                :show-file-list="false"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload"
                accept="image/jpeg,image/png,image/gif"
              >
                <template v-if="importPhotoFlag">
                  <img :src="$http.defaults.baseURL+'binfo/person/photo/'+editForm.a0000" class="avatar">
                </template>
                <template v-else>
                  <img v-if="imageUrl" :src="this.$http.defaults.baseURL+$http.defaults.youngAPI+'api/gen/file/download?id='+parseInt(imageUrl)" class="avatar">
                  <i v-else class="el-icon-plus avatar-uploader-icon" />
                </template>
              </el-upload>
              <el-button type="danger" v-if="!readOnly&&(imageUrl||importPhotoFlag)" @click="removePhoto">删除照片</el-button>
              <div v-if="!readOnly" style="font-size:var(--size12) !important;">照片格式：JPG或PNG，大小不超过1MB</div>
            </td>
          </tr>
          <tr>
            <th>民族</th>
            <td>
              <template v-if="readOnly">{{id2name(editForm.mz,mzoptions)}}</template>
              <el-form-item prop="mz" v-else>
                <el-select v-model="editForm.mz" placeholder="请选择" style="width:150px">
                  <el-option
                    v-for="item in mzoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
            <th>政治面貌</th>
            <td>
              <template v-if="readOnly">{{id2name(editForm.zzmm,zzmmoptions)}}</template>
              <el-form-item prop="zzmm" v-else>
                <el-select v-model="editForm.zzmm" placeholder="请选择">
                  <el-option
                    v-for="item in zzmmoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
            <th>参加工作时间</th>
            <td>
              <template v-if="readOnly">{{formatDate(editForm.cjgzsj)}}</template>
              <el-form-item prop="cjgzsj" v-else>
                <el-input v-model="editForm.cjgzsj" style="width:170px" placeholder="如20201001或202010"></el-input>
                <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                  <el-button type="text" icon="el-icon-info" />
                </el-tooltip>
              </el-form-item>
            </td>
            <th>专业技术职务</th>
            <td>
              <template v-if="readOnly">{{editForm.zyjszw}}</template>
              <el-form-item prop="zyjszw" v-else>
                <el-input v-model="editForm.zyjszw" style="width:200px"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th>职务</th>
            <td>
              <template v-if="readOnly">{{editForm.zw}}</template>
              <el-form-item prop="zw" v-else>
                <el-input v-model="editForm.zw" style="width:200px"></el-input>
              </el-form-item>
            </td>
            <th>任现职务时间</th>
            <td>
              <template v-if="readOnly">{{formatDate(editForm.rxzwsj)}}</template>
              <el-form-item prop="rxzwsj" v-else>
                <el-input v-model="editForm.rxzwsj" style="width:170px" @focus="onInputFocus" @blur="onInputBlur" placeholder="如20201001或202010"></el-input>
                <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                  <el-button type="text" icon="el-icon-info" />
                </el-tooltip>
              </el-form-item>
            </td>
            <th rowspan="2" style="vertical-align: top;">任相当层次职务职级时间</th>
            <td colspan="3" rowspan="2">
              <template v-if="readOnly">{{formatDate(editForm.rxdcczwzjsj)}}</template>
              <el-form-item prop="rxdcczwzjsj" v-else>
                <el-input v-model="editForm.rxdcczwzjsj" style="width:170px" placeholder="如20201001或202010"></el-input>
                <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                  <el-button type="text" icon="el-icon-info" />
                </el-tooltip>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th>职级</th>
            <td>
              <template v-if="readOnly">{{editForm.zj}}</template>
              <el-form-item prop="zj" v-else>
                <el-input v-model="editForm.zj" style="width:150px"></el-input>
              </el-form-item>
            </td>
            <th>任现职级时间</th>
            <td>
              <template v-if="readOnly">{{formatDate(editForm.rxzjsj)}}</template>
              <el-form-item prop="rxzjsj" v-else>
                <el-input v-model="editForm.rxzjsj" style="width:170px" placeholder="如20201001或202010"></el-input>
                <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                  <el-button type="text" icon="el-icon-info" />
                </el-tooltip>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th>近三年考核情况</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.jsnkhqk.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.jsnkhqk" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>教育背景</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.jybj.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.jybj" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>工作简历</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.gzjl.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.gzjl" style="width:100%" rows="10"></el-input>
            </td>
          </tr>
          <tr>
            <th>分管或从事工作</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.fghcsgz.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.fghcsgz" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>政治素质及政治表现</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.zzszjzzbx.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.zzszjzzbx" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>能力特点、工作实绩和主要事例</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.nltd.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.nltd" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>主要不足</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.zybz.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.zybz" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>“四必”及巡视、信访、审计等情况</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.sbjxsxfsjdqk.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.sbjxsxfsjdqk" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>本人面谈情况</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.brmtqk.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.brmtqk" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>培养方向和培养措施</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.pyfxhpycs.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.pyfxhpycs" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>备注</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.bz.replace(/\n/g,'<br>')"></div>
              <el-input v-else type="textarea" v-model="editForm.bz" style="width:100%"></el-input>
            </td>
          </tr>
          <tr>
            <th>附件</th>
            <td colspan="8">
              <el-upload v-if="!readOnly"
                class="upload-demo"
                ref="upload"
                :action="this.$http.defaults.baseURL+this.$http.defaults.youngAPI +'api/gen/file/upload/'"
                :on-success="handleUploadSucc"
                :on-remove="handleRemove"
                :before-remove="beforeRemove"
                :on-error="uploadError"
                :multiple="true"
                :file-list="fileList"
                :on-preview="handlePreview"
                :before-upload="beforeUpload"
              >
                <el-button type="primary">点击上传</el-button>
              </el-upload>
              <div v-else>
                <div v-for="(item,index) in fileList" :key="index">
                  <el-link
                    :href="$http.defaults.baseURL+$http.defaults.youngAPI+'api/gen/file/download?id='+item.id"
                    icon="el-icon-paperclip"
                  >{{ item.name }}</el-link>
                </div>
              </div>
            </td>
          </tr>
          <tr v-if="!inRoles('ROLE_other')" class="passed">
            <th v-if="!this.Formal">是否入库</th>
            <td v-if="!this.Formal">
              <template v-if="readOnly">{{editForm.passed===1?'入库':''}}{{editForm.passed===2?'不入库':''}}</template>
              <el-form-item prop="passed" v-else>
                <el-radio-group v-model="editForm.passed">
                  <el-radio :label="1">入库</el-radio>
                  <el-radio :label="2">不入库</el-radio>
                </el-radio-group>
              </el-form-item>
            </td>
            <th>职务职级层次</th>
            <td>
              <template v-if="readOnly">{{editForm.shflText}}</template>
              <el-form-item prop="shfl" v-else>
                <el-select v-model="editForm.shfl" placeholder="请选择">
                  <el-option
                    v-for="item in shfloptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
            <th>来源类型</th>
            <td>
              <template v-if="readOnly">{{editForm.lyflText}}</template>
              <el-form-item prop="lyfl" v-else>
                <el-select v-model="editForm.lyfl" placeholder="请选择">
                  <el-option
                    v-for="item in lyfloptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
            <th>培养使用建议类型</th>
            <td :colspan="this.Formal?4:2" >
              <template v-if="readOnly">{{editForm.pysyjylxText}}</template>
              <el-form-item prop="pysyjylx" v-else>
                <el-select v-model="editForm.pysyjylx" placeholder="请选择">
                  <el-option
                    v-for="item in pysyjylxoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </td>
          </tr>
          <tr v-if="!inRoles('ROLE_other')&&(Formal||(!Formal&&passStep===2)||(!Formal&&passStep===1&&opinionFlag))" class="passed">
            <th>入库依据</th>
            <td colspan="8">
              <div v-if="readOnly" v-html="editForm.rkyj&&editForm.rkyj.replace(/\n/g,'<br>')"></div>
              <el-autocomplete v-else :trigger-on-focus="true" :fetch-suggestions="querySearch" v-model="editForm.rkyj" style="width:100%" :maxlength="500"></el-autocomplete>
            </td>
          </tr>
        </table>
        <div style="margin:0 10px">
          <el-checkbox v-if="state===1&&!readOnly" v-model="readed" label="已审" style="margin-left:20px;" />
          <template v-if="!readOnly">
            <el-button v-if="state!==2" type="primary" @click.native="editFormSubmit()" :loading="saveloading" style="margin-left:20px;">保存</el-button>
            <el-button v-if="passed0===2&&state===2" type="primary" @click.native="reEnter" :loading="saveloading" style="margin-left:20px;">补充入库</el-button>
          </template>
          <el-button @click.native="backToList">返回</el-button>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  watch: {
    timestamp: {
      handler (val) {
        // this.$refs['editForm'].resetFields()
        this.editFormReset()
        if (this.personId && this.personId !== '') {
          this.getDetail(this.personId)
        }
        this.init()
      },
      immediate: true
    }
  },
  props: {
    state: '', // state===2从已完成列表点击编辑
    Formal: false,
    showDept: true,
    personId: '',
    readOnly: '',
    timestamp: '',
    passStep: ''
  },
  data () {
    return {
      importPhotoFlag: false,
      imageUrl: '',
      original: {
        id: '',
        xm: '',
        sfzh: '',
        xb: '',
        csrq: '',
        mz: '',
        zzmm: '',
        cjgzsj: '',
        zyjszw: '',
        zw: '',
        rxzwsj: '',
        rxdcczwzjsj: '',
        zj: '',
        rxzjsj: '',
        jsnkhqk: '',
        jybj: '',
        gzjl: '',
        fghcsgz: '',
        zzszjzzbx: '',
        nltd: '',
        zybz: '',
        sbjxsxfsjdqk: '',
        brmtqk: '',
        pyfxhpycs: '',
        bz: '',
        zzbxjjtsl: '',
        zmyhzbmydgzjjtsl: '',
        zytdjjtsl: '',
        zybzjjtsl: '',
        ssdw: '',
        shfl: '',
        lyfl: '',
        pysyjylx: '',
        rkyj: '',
        passed: null,
        files: []
      },
      showlog: false,
      passed0: null,
      readed: false,
      files: [],
      fileList: [],
      pageLoading: false,
      editForm: {
        a0000: '',
        id: '',
        xm: '',
        sfzh: '',
        xb: '',
        csrq: '',
        mz: '',
        zzmm: '',
        cjgzsj: '',
        zyjszw: '',
        zw: '',
        rxzwsj: '',
        rxdcczwzjsj: '',
        zj: '',
        rxzjsj: '',
        jsnkhqk: '',
        jybj: '',
        gzjl: '',
        fghcsgz: '',
        zzszjzzbx: '',
        nltd: '',
        zybz: '',
        sbjxsxfsjdqk: '',
        brmtqk: '',
        pyfxhpycs: '',
        bz: '',
        zzbxjjtsl: '',
        zmyhzbmydgzjjtsl: '',
        zytdjjtsl: '',
        zybzjjtsl: '',
        ssdw: '',
        shfl: '',
        lyfl: '',
        pysyjylx: '',
        rkyj: '',
        passed: null,
        trialFlag: null,
        retrialFlag: null
      },
      editFormRules: {
        ssdw: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        xm: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        sfzh: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        xb: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        csrq: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        mz: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        zzmm: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        cjgzsj: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        zyjszw: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        zw: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        zj: [
          { required: true, message: '必填项', trigger: 'change' }
        ]
      },
      zzmmoptions: [],
      xboptions: [],
      mzoptions: [],
      dwoptions: [],
      shfloptions: [],
      lyfloptions: [],
      pysyjylxoptions: [],
      saveloading: false,
      userRoles: '',
      unitname: '',
      opinionFlag: false,
      oldunit: 0
    }
  },
  methods: {
    removePhoto () {
      this.imageUrl = 0
      this.importPhotoFlag = false
    },
    querySearch (queryString, cb) {
      return this.getNotice(this, queryString, cb)
    },
    getNotice (self, queryString, cb) {
      let para = {
        key: queryString
      }
      self.$http
        .post(this.$http.defaults.youngAPI + `api/busOpinion/getRecentList`, para)
        .then(function (response) {
          console.log('获取成功')
          var results = response.data.result
          let newArr = []
          results.forEach(function (item) {
            let obj = {'value': item}
            newArr.push(obj)
          })
          cb(newArr)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    handleAvatarSuccess (res, file) {
      // this.imageUrl = URL.createObjectURL(file.raw)
      console.log('test')
      if (res.success) {
        this.$message({
          message: '上传成功！',
          type: 'success'
        })
        this.imageUrl = res.result[0].id
        this.importPhotoFlag = false
        // this.fileList = []
        // this.files = []
      } else {
        this.$message({
          message: '上传失败:' + res.message,
          type: 'error'
        })
      }
    },
    beforeAvatarUpload (file) {
      const isJPG = file.type === 'image/jpeg'
      const isPNG = file.type === 'image/png'
      const isGIF = file.type === 'image/gif'
      const isLt20M = file.size / 1024 / 1024 < 1

      if (!isJPG && !isPNG && !isGIF) {
        this.$message.error('请上传标准证件照片图片，上传图片只能是 JPG 或 PNG 格式!')
        return false
      }
      if (!isLt20M) {
        this.$message.error('请上传标准证件照片图片，上传图片大小不能超过 1MB!')
        return false
      }
    },
    beforeUpload () {
      this.saveloading = true
    },
    formatDate (str) {
      if (str) {
        return str.slice(0, 4) + '.' + str.slice(4, 6)
      }
    },
    reEnter () {
      if (this.editForm.passed !== 1) {
        this.$message({
          message: '请将是否入库选择为入库',
          type: 'error'
        })
        return false
      }
      if (!this.editForm.shfl) {
        this.$message({
          message: '请选择职务职级层次',
          type: 'error'
        })
        return false
      }
      if (!this.editForm.lyfl) {
        this.$message({
          message: '请来源类型',
          type: 'error'
        })
        return false
      }
      if (!this.editForm.pysyjylx) {
        this.$message({
          message: '请选择培养使用建议类型',
          type: 'error'
        })
        return false
      }
      if (!this.editForm.rkyj) {
        this.$message({
          message: '请填写入库依据',
          type: 'error'
        })
        return false
      }
      this.editFormSubmit(true) // 提交表单并补充入库
    },
    reEnterSubmit () {
      let para = {candidateUserId: this.editForm.id}
      this.$http
        .post(this.$http.defaults.youngAPI + 'api/busFormalPerson/addCandidateUser', para)
        .then(response => {
          this.saveloading = false
          if (response.data.success) {
            if (response.data.result && response.data.result.length > 0) {
              this.$alert('注意：此身份证号（' + response.data.result[0] + '）在正式库中已存在', '入库成功', {
                confirmButtonText: '确定'
              })
            } else {
              this.$message({
                message: '入库成功',
                type: 'success'
              })
            }
            this.editFormReset()
            this.$emit('dialogHide', true)
          } else {
            this.$message({
              message: '入库失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.saveloading = false
          console.log(error)
          this.$message({
            message: '网络入库失败:' + error,
            type: 'error'
          })
        })
    },
    id2name (id, arr) {
      if (id) {
        let myobj = arr.filter(item => parseInt(item.value) === parseInt(id))
        if (myobj && myobj.length > 0) {
          return myobj[0].label
        }
      }
    },
    name2id (name, arr) {
      if (name) {
        let myobj = arr.filter(item => item.label === name)
        if (myobj && myobj.length > 0) {
          return myobj[0].value
        }
      }
    },
    onInputFocus () {},
    onInputBlur () {},
    inRoles (str) {
      let arr = this.userRoles
      if (arr.indexOf(str) === -1) {
        return false
      } else {
        return true
      }
    },
    init () {
      this.getOpinionFlag()
      this.getDics()
      this.userRoles = localStorage.getItem('Roles')
      this.unitname = localStorage.getItem('Otherunitname')
      if (this.inRoles('ROLE_other')) {
        this.editForm.ssdw = localStorage.getItem('Otherunitid')
      }
    },
    formatFiles (files) {
      if (files && files.length > 0) {
        const newfiles = []
        for (let i = 0; i < files.length; i++) {
          newfiles.push({ name: files[i].fileName + '.' + files[i].fileType, id: files[i].id })
        }
        console.log(newfiles)
        return newfiles
      }
    },
    formatSuccList (fileList) {
      if (fileList && fileList.length > 0) {
        const newfiles = []
        for (let i = 0; i < fileList.length; i++) {
          if (fileList[i].response) {
            newfiles.push({ name: fileList[i].response.result[0].fileName + '.' + fileList[i].response.result[0].fileType, id: fileList[i].response.result[0].id })
          } else {
            newfiles.push(fileList[i])
          }
        }
        console.log(newfiles)
        return newfiles
      }
    },
    handleUploadSucc (response, file, fileList) {
      console.log(response)
      this.saveloading = false
      if (response.success) {
        console.log(response.result[0])

        this.files.push(response.result[0])
        this.fileList = this.formatSuccList(fileList)
        this.$message({
          message: '上传成功！' + response.message,
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    beforeRemove (file, fileList) {
      if (this.personId && this.personId !== '') {
        return this.$confirm(`删除附件操作无需保存，即时生效，确定删除 ${file.name}？`)
      } else {
        return this.$confirm(`确定删除 ${file.name}？`)
      }
    },
    handleRemove (file, fileList) {
      console.log(file, fileList)
      const fid = file.id
      const url = 'api/gen/file/remove'
      let para = {
        params: {
          id: fid
        }
      }
      if (this.personId && this.Formal) {
        para = {
          params: {
            id: fid,
            saveLog: true
          }
        }
      }
      this.$http.get(this.$http.defaults.youngAPI + url, para).then(res => {
        console.log('删除成功:', res)
        if (res.data.success === true) {
          const newfiles = []
          for (let i = 0; i < this.files.length; i++) {
            if (this.files[i].id !== fid) {
              newfiles.push(this.files[i])
            }
          }
          this.files = newfiles
          this.fileList = this.formatFiles(this.files)
          this.$message({
            message: '删除成功！',
            type: 'success'
          })
        }
      })
    },
    uploadError (err) {
      this.saveloading = false
      console.log(err)
      this.$message({
        message: '上传失败:' + err,
        type: 'error'
      })
    },
    handlePreview (file) {
      if (window.navigator.msSaveOrOpenBlob) {
        navigator.msSaveBlob(this.$http.defaults.baseURL + this.$http.defaults.youngAPI + 'api/gen/file/download?id=' + file.id, file.name)
      } else {
        var link = document.createElement('a')
        link.download = file.name
        link.href = this.$http.defaults.baseURL + this.$http.defaults.youngAPI + 'api/gen/file/download?id=' + file.id
        link.click()
        console.log(this.$http.defaults.youngAPI + 'api/gen/file/download?id=' + file.id)
        window.URL.revokeObjectURL(link.href)
      }
    },
    getDics () {
      this.$http
        .get(this.$http.defaults.youngAPI + `api/young/jiben/getGenderDictList`)
        .then(response => {
          if (response.data.success) {
            this.xboptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      this.$http
        .get(this.$http.defaults.youngAPI + `api/young/jiben/getNationDictList`)
        .then(response => {
          if (response.data.success) {
            this.mzoptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      this.$http
        .get(this.$http.defaults.youngAPI + `api/young/jiben/getPoliticalDictList`)
        .then(response => {
          if (response.data.success) {
            this.zzmmoptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      let deptCode = ''
      switch (localStorage.getItem('unitName')) {
        case '干部一处':
          deptCode = 1
          break
        case '干部二处':
          deptCode = 2
          break
        case '干部三处':
          deptCode = 3
          break
      }
      this.$http
        .post(this.$http.defaults.youngAPI + `api/busUnit/queryList`, {deptCode: deptCode})
        .then(response => {
          if (response.data.success) {
            this.dwoptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      this.$http
        .get(this.$http.defaults.youngAPI + `api/sysDict/getByCode?code=03`)
        .then(response => {
          if (response.data.success) {
            this.shfloptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      this.$http
        .get(this.$http.defaults.youngAPI + `api/sysDict/getByCode?code=01`)
        .then(response => {
          if (response.data.success) {
            this.lyfloptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      this.$http
        .get(this.$http.defaults.youngAPI + `api/sysDict/getByCode?code=02`)
        .then(response => {
          if (response.data.success) {
            this.pysyjylxoptions = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getDetail (id) {
      let url = ''
      if (this.Formal) {
        url = 'api/busFormalPerson/getInfo'
      } else {
        url = 'api/busCandidatePerson/getInfo'
      }
      this.pageLoading = true
      this.$http
        .get(this.$http.defaults.youngAPI + url + `?id=` + id)
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.editForm = response.data.result
            this.oldunit = response.data.result.ssdw
            this.imageUrl = this.editForm.tx
            this.passed0 = response.data.result.passed // 审核完成时是否通过
            if (this.editForm.files) {
              this.files = this.editForm.files
              this.fileList = this.formatSuccList(this.editForm.files)
            } else {
              this.files = []
              this.fileList = []
            }

            if (this.inRoles('ROLE_chuzhang')) {
              this.readed = !!response.data.result.retrialFlag
            }
            if (this.inRoles('ROLE_banshirenyuan')) {
              this.readed = !!response.data.result.trialFlag
            }
            if (!this.Formal && response.data.result.state !== 0) {
              this.getOriginalInfo(response.data.result.id)
            }
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getOriginalInfo (id) {
      let url = 'api/busCandidatePerson/getOriginalPersonInfo'
      this.pageLoading = true
      this.$http
        .get(this.$http.defaults.youngAPI + url + `?id=` + id)
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.original = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    backToList () {
      this.$emit('dialogHide', false)
    },
    handleSelect (item) {
      this.editForm.sfzh = item.data.a0184
      this.editForm.zw = item.data.a0192A
      this.editForm.xb = this.name2id(item.data.a0104, this.xboptions)
      this.editForm.csrq = item.data.a0107
      this.editForm.mz = this.name2id(item.data.a0117, this.mzoptions)
      this.editForm.zzmm = this.name2id(item.data.a0141, this.zzmmoptions)
      this.editForm.cjgzsj = item.data.a0134
      this.editForm.zyjszw = item.data.a0196
      this.editForm.zw = item.data.a0192A
      this.editForm.rxzwsj = item.data.a0288
      this.editForm.zj = item.data.a0192E
      this.editForm.rxzjsj = item.data.a0192C
      this.editForm.jsnkhqk = item.data.a15Z101
      this.editForm.a0000 = item.data.a0000
      let jybj = ''
      if (item.data.qrzxl || item.data.qrzxw || item.data.qrzxlxx || item.data.qrzxwxx) {
        jybj = jybj + '全日制教育'
      }
      if (item.data.qrzxl) {
        jybj = jybj + '学历：' + item.data.qrzxl + ' '
      }
      if (item.data.qrzxw) {
        jybj = jybj + '学位：' + item.data.qrzxw + ' '
      }
      if (item.data.qrzxlxx) {
        jybj = jybj + '毕业院校：' + item.data.qrzxlxx + ' '
      }
      if (item.data.qrzxwxx) {
        jybj = jybj + '专业：' + item.data.qrzxwxx + ' '
      }
      if (item.data.qrzxl || item.data.qrzxw || item.data.qrzxlxx || item.data.qrzxwxx) {
        jybj = jybj + '\n'
      }
      if (item.data.zzxl || item.data.zzxw || item.data.zzxlxx || item.data.zzxwxx) {
        jybj = jybj + '在职教育'
      }
      if (item.data.zzxl) {
        jybj = jybj + '学历：' + item.data.zzxl + ' '
      }
      if (item.data.zzxw) {
        jybj = jybj + '学位：' + item.data.zzxw + ' '
      }
      if (item.data.zzxlxx) {
        jybj = jybj + '毕业院校：' + item.data.zzxlxx + ' '
      }
      if (item.data.zzxwxx) {
        jybj = jybj + '专业：' + item.data.zzxwxx + ' '
      }
      console.log(jybj)
      this.editForm.jybj = jybj
      this.editForm.gzjl = item.data.a1701Text
      this.importPhotoFlag = true
    },
    searchPerson (queryString, cb) {
      return this.getpersons(this, queryString, cb)
    },
    getpersons (self, queryString, cb) {
      let para = {
        realname: queryString,
        unitname: this.id2name(this.editForm.ssdw, this.dwoptions)
        // unitname: '区委组织部123'
      }
      console.log(para)
      self.$http
        .get(this.$http.defaults.youngAPI + `api/young/jiben`, {params: para})
        .then(function (response) {
          console.log('获取成功')
          var results = response.data.result
          let newArr = []
          results.forEach(function (item) {
            let obj = {'value': item.a0101, 'data': item}
            newArr.push(obj)
          })
          cb(newArr)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    editFormReset () {
      this.readed = false
      this.editForm = {
        a0000: '',
        id: '',
        xm: '',
        sfzh: '',
        xb: '',
        csrq: '',
        mz: '',
        zzmm: '',
        cjgzsj: '',
        zyjszw: '',
        zw: '',
        rxzwsj: '',
        rxdcczwzjsj: '',
        zj: '',
        rxzjsj: '',
        jsnkhqk: '',
        jybj: '',
        gzjl: '',
        fghcsgz: '',
        zzszjzzbx: '',
        nltd: '',
        zybz: '',
        sbjxsxfsjdqk: '',
        brmtqk: '',
        pyfxhpycs: '',
        bz: '',
        zzbxjjtsl: '',
        zmyhzbmydgzjjtsl: '',
        zytdjjtsl: '',
        zybzjjtsl: '',
        ssdw: '',
        shfl: '',
        lyfl: '',
        pysyjylx: '',
        rkyj: '',
        passed: null,
        trialFlag: null,
        retrialFlag: null
      }
      if (this.$refs['editForm']) {
        this.$refs['editForm'].resetFields()
      }
      this.showlog = false
      this.files = []
      this.fileList = []
      this.imageUrl = ''
      this.importPhotoFlag = false
      if (this.$refs.upload) {
        this.$refs.upload.clearFiles()
      }
    },
    editFormSubmit (reEnterFlag) {
      this.$refs.editForm.validate((valid) => {
        if (valid) {
          this.saveloading = true
          if (!this.isDate8(this.editForm.csrq) && !this.isDate6(this.editForm.csrq) && this.editForm.csrq) {
            this.$message({
              message: '出生日期格式有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          if (!this.isDate8(this.editForm.cjgzsj) && !this.isDate6(this.editForm.cjgzsj) && this.editForm.cjgzsj) {
            this.$message({
              message: '参加工作时间格式有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          if (!this.isDate8(this.editForm.rxzwsj) && !this.isDate6(this.editForm.rxzwsj) && this.editForm.rxzwsj) {
            this.$message({
              message: '任现职务时间格式有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          if (!this.isDate8(this.editForm.rxdcczwzjsj) && !this.isDate6(this.editForm.rxdcczwzjsj) && this.editForm.rxdcczwzjsj) {
            this.$message({
              message: '任相当层次职务职级时间格式有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          if (!this.isDate8(this.editForm.rxzjsj) && !this.isDate6(this.editForm.rxzjsj) && this.editForm.rxzjsj) {
            this.$message({
              message: '任现职级时间格式有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }

          let para = {
            id: this.editForm.id,
            xm: this.editForm.xm,
            sfzh: this.editForm.sfzh,
            xb: this.editForm.xb,
            csrq: this.editForm.csrq,
            mz: this.editForm.mz,
            zzmm: this.editForm.zzmm,
            cjgzsj: this.editForm.cjgzsj,
            zyjszw: this.editForm.zyjszw,
            zw: this.editForm.zw,
            rxzwsj: this.editForm.rxzwsj,
            rxdcczwzjsj: this.editForm.rxdcczwzjsj,
            zj: this.editForm.zj,
            rxzjsj: this.editForm.rxzjsj,
            jsnkhqk: this.editForm.jsnkhqk,
            jybj: this.editForm.jybj,
            gzjl: this.editForm.gzjl,
            fghcsgz: this.editForm.fghcsgz,
            zzszjzzbx: this.editForm.zzszjzzbx,
            nltd: this.editForm.nltd,
            zybz: this.editForm.zybz,
            sbjxsxfsjdqk: this.editForm.sbjxsxfsjdqk,
            brmtqk: this.editForm.brmtqk,
            pyfxhpycs: this.editForm.pyfxhpycs,
            bz: this.editForm.bz,
            zzbxjjtsl: this.editForm.zzbxjjtsl,
            zmyhzbmydgzjjtsl: this.editForm.zmyhzbmydgzjjtsl,
            zytdjjtsl: this.editForm.zytdjjtsl,
            zybzjjtsl: this.editForm.zybzjjtsl,
            ssdw: this.editForm.ssdw,
            shfl: this.editForm.shfl,
            lyfl: this.editForm.lyfl,
            pysyjylx: this.editForm.pysyjylx,
            rkyj: this.editForm.rkyj,
            files: this.files.map(item => item.id),
            changeUnit: this.oldunit !== this.editForm.ssdw
          }
          console.log('this.importPhotoFlag:' + this.importPhotoFlag)
          console.log('this.imageUrl:' + this.imageUrl)
          if (this.importPhotoFlag) {
            para.a0000 = this.editForm.a0000
          } else {
            para.tx = this.imageUrl
          }
          let url = ''
          if (this.Formal) {
            url = 'api/busFormalPerson/saveInfo'
            if (!this.editForm.shfl) {
              this.$message({
                message: '请选择职务职级层次',
                type: 'error'
              })
              this.saveloading = false
              return false
            }
            if (!this.editForm.lyfl) {
              this.$message({
                message: '请来源类型',
                type: 'error'
              })
              this.saveloading = false
              return false
            }
            if (!this.editForm.pysyjylx) {
              this.$message({
                message: '请选择培养使用建议类型',
                type: 'error'
              })
              this.saveloading = false
              return false
            }
            if (!this.editForm.rkyj) {
              this.$message({
                message: '请填写入库依据',
                type: 'error'
              })
              this.saveloading = false
              return false
            }
          } else {
            url = 'api/busCandidatePerson/saveInfo'
            para.passed = this.editForm.passed
            if (this.inRoles('ROLE_chuzhang')) {
              if (this.readed) {
                para.retrialFlag = 1
              } else {
                para.retrialFlag = 0
              }
            }
            if (this.inRoles('ROLE_banshirenyuan')) {
              if (this.readed) {
                para.trialFlag = 1
              } else {
                para.trialFlag = 0
              }
            }
          }
          this.$http
            .post(this.$http.defaults.youngAPI + url, para)
            .then(response => {
              this.saveloading = false
              if (response.data.success) {
                if (reEnterFlag) {
                  this.reEnterSubmit()
                } else {
                  this.$message({
                    message: '保存成功',
                    type: 'success'
                  })
                }
                this.editFormReset()
                this.$emit('dialogHide', true)
              } else {
                this.$message({
                  message: '保存失败:' + response.data.message,
                  type: 'error'
                })
              }
            })
            .catch(error => {
              this.saveloading = false
              console.log(error)
              this.$message({
                message: '网络保存失败:' + error,
                type: 'error'
              })
            })
        }
      })
    },
    isDate8 (sDate) {
      if (!/^[0-9]{8}$/.test(sDate)) {
        return false
      }
      var year, month, day
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      day = sDate.substring(6, 8)
      var iaMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
      if (year < 1700 || year > 2500) return false
      if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) iaMonthDays[1] = 29
      if (month < 1 || month > 12) return false
      if (day < 1 || day > iaMonthDays[month - 1]) return false
      return true
    },
    isDate6 (sDate) {
      if (!/^[0-9]{6}$/.test(sDate)) {
        return false
      }
      var year, month
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      if (year < 1700 || year > 2500) return false
      if (month < 1 || month > 12) return false
      return true
    },
    getOpinionFlag () { // 初审是否需要填写入库依据，根据后台配置文件返回
      this.$http
        .get(this.$http.defaults.youngAPI + `api/busOpinion/showOpinion`)
        .then(response => {
          if (response.data.success) {
            this.opinionFlag = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    }
  },
  mounted () {
    this.init()
  }
}
</script>
<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 120px;
    height: 150px;
    line-height: 150px;
    text-align: center;
  }
  .avatar {
    width: 120px;
    height: 150px;
    display: block;
  }
  #youngcadresedit h1{
    font-size:var(--size16) !important;
    font-weight: bolder;
    height: 30px;
    border-bottom: 1px solid #95B8E7;
    font-family: '宋体';
    line-height: 30px;
    color: #000;
    padding-left:10px;
    background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
    margin:0 0 20px;
  }
  #youngcadresedit .el-table{
    border: #95B8E7 solid 1px;
  }
  #youngcadresedit .mytable{
    border-top: 1px solid #74A6CC;
    border-left: 1px solid #74A6CC;
    margin: 10px;
    width: calc(100% - 20px);
    font-size:var(--size14) !important;
    font-family: '宋体'
  }
  #youngcadresedit .mytable th,
  #youngcadresedit .mytable td{
    padding: 10px;
    border-right: 1px solid #74A6CC;
    border-bottom: 1px solid #74A6CC;
    vertical-align:top;
    line-height: 150%;
    height: 22px;
  }
  #youngcadresedit .mytable th{
    background:#C0DCF1;
    width:120px;
    vertical-align: middle;
  }
  #youngcadresedit .mytable .passed th{
    background:#F7E4BB;
  }
  #youngcadresedit .mytable .passed td{
    background:#FBF0DB;
  }
  .youngnopic{
    background: url(../assets/nopic.gif) no-repeat;
    width: 120px;
    height: 150px;
  }
</style>
<style scoped>
.details{
  font-weight:bolder;
  border-bottom:1px solid #95B8E7;
  padding:0 10px;
  min-height: 36px;
}
</style>
